Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

compare-cell

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

compare-cell

An ordering for sets of integers

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
22K
decreased by-4.18%
Maintainers
1
Weekly downloads
 
Created
Source

compare-cell

Compares two unordered integer sequences to test if they contain the same elements. This can be used to implement various algorithms for unoriented simplicial complexes.

For more information, see the following blog post:

Comparing sequences without sorting

Example

var compareCells = require('compare-cell')
var bsearch = require('binary-search-bounds')

//Create a list of triangles defined by indexed faces
var triangles = [
  [1, 0, 2],
  [2, 1, 3],
  [3, 4, 5],
  [5, 6, 7]
]

//Sort triangles
triangles.sort(compareCells)

//Now we can test if various cells are contained in the list in O(log n)
console.log(bsearch.eq(triangles, [2, 1, 0], compareCells) >= 0)
console.log(bsearch.eq(triangles, [3, 5, 7], compareCells) >= 0)

API

var d = require('compare-cells')(a, b)

Tests if two unordered lists contain the same elements.

  • a, b are arrays of integers

Returns An order function which tests if a comes before or after b. The value is 0 if they are equal.

License

(c) 2015 Mikola Lysenko. MIT License

Keywords

FAQs

Package last updated on 19 Jun 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc